package org.pwwong.scalautils.collection

class WeakSet[A] extends scala.collection.mutable.Set[A] {
	private val map = new java.util.WeakHashMap[A,AnyRef]
 	def -=(el: A) { map.remove(el) }
	def +=(el: A) { map.put(el, null) }
	def contains(el: A) = map.containsKey(el)
	def size = map.size
	def elements = (new scala.collection.jcl.IterableWrapper[A] {def underlying = WeakSet.this.map.keySet }).elements
}
